/***************************************************************************
 *   Copyright (C) 2005 by xihe                                            *
 *   xihels@163.com                                                        *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef _CLUSTER_INFO_H_
#define _CLUSTER_INFO_H_

#include "FriendInfo.h"
#include "BuddyMap.h"

#include "ClusterInfoReply.h"

class ClusterInfo : public BuddyInfo {
    public:
	typedef BuddyMap<FriendInfo> Members;

	Members& getMembers() { return members; }

	uint32_t getExternalUid() const { return externalId; }

	uint8_t  getClusterType() const { return clusterType; }
	uint32_t getCreator()	  const	{ return creator; }
	uint8_t  getAuthType()	  const	{ return authType; }
	uint16_t getCategory()	  const { return category; }

	const string& getNotice()	const { return notice; }
	const string& getDescribing()	const { return describing; }

	uint32_t getVersionId() const { return versionId; }
	void setVersionId(uint32_t id) { versionId = id; }

	bool isCluster()	    const { return true; }


	explicit ClusterInfo(const QQGroupFriend& rhs);
	explicit ClusterInfo(const GetClusterInfoReplyPacket& rhs);

	ClusterInfo& operator = (const GetClusterInfoReplyPacket& rhs);

    private:
	string notice;
	string describing;
	Members members;

	// 如果是固定群，这个表示外部ID，如果是临时群，这个表示父群ID
	uint32_t externalId;
	uint32_t creator;
	uint32_t versionId; // 这个群的版本号，如果群信息有变动，版本号加1.
	
	uint16_t category;
	// clusterType 字段表示固定群或者临时群的群类型
	uint8_t  clusterType;
	uint8_t  authType;
};

#endif // _CLUSTER_INFO_H_

